package com.informatics.polymer.client.browserepository;

import com.google.gwt.user.client.ui.Image;
import com.smartgwt.client.widgets.grid.ListGridRecord;

/**
 * Class to create a custom list grid record to contain information on on the
 * repeat unit id, structure and CDK properties.
 * 
 * @author ed
 * @version 1.0
 */
public class ViewDataRecord extends ListGridRecord {
	/**
	 * Value representing the number of descriptors.
	 */
	private static final int descriptorLength = 16;
	/**
	 * The unique ID for the repeat unit.
	 */
	private String repeatUnitID;
	/**
	 * Image of the repeat unit.
	 */
	private Image repeatUnitImage;
	/**
	 * String representation of the image of resource.
	 */
	private String img;
	/**
	 * Create Double array to hold descriptor data.
	 */
	private double descriptors[] = new double[descriptorLength];

	/**
	 * Creates a ViewDataRecord.
	 * 
	 * @param id
	 *            - String representation of the repeat unit id.
	 * @param anImage
	 *            - Image representation of the repeat unit.
	 * @param descriptorValues
	 *            - double array containing descriptors calculated for the
	 *            repeat unit.
	 */
	public ViewDataRecord(final String id, final Image anImage,
			double[] descriptorValues) {
		this.repeatUnitID = id;
		this.repeatUnitImage = anImage;
		this.descriptors = descriptorValues;
	}

	/**
	 * Creates a ViewDataRecord.
	 * 
	 * @param id
	 *            - String representation of the repeat unit id.
	 * @param anImage
	 *            - String representation of image.
	 * @param descriptorValues
	 *            - double array of descriptor values.
	 */
	public ViewDataRecord(final String id, final String anImage,
			double[] descriptorValues) {
		this.repeatUnitID = id;
		this.img = anImage;
		this.descriptors = descriptorValues;
	}

	/**
	 * Gets Id.
	 * 
	 * @return String representation of the repeat unit Id.
	 */
	public String getId() {
		return repeatUnitID;
	}

	/**
	 * Gets Image.
	 * 
	 * @return String URL of the image.
	 */
	public String getImg() {
		return img;
	}

	/**
	 * Gets Image.
	 * 
	 * @return Image of repeat unit.
	 */
	public Image getImage() {
		return repeatUnitImage;
	}

	/**
	 * Gets calculated descriptors.
	 * 
	 * @return double array of descriptor values.
	 */
	public double[] getDescriptors() {
		return descriptors;
	}
}
